From 5d4e92412ea79ff6a085b756721ddc735a99aa1d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 1 Feb 2007 10:20:34 +0000 Subject: [PATCH] [LINUX] netfront: Don't call netif_carrier_off until the device is fuly allocated. netif_carrier_off() causes events to be queued on the device so if we subsequently abort the allocation (e.g. due to lack of grant entries) then we crash trying to access the now invalid device. Signed-off-by: Ian Campbell --- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index f54cc84b89..bd86948fed 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -1935,8 +1935,6 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev) np = netdev_priv(netdev); np->xbdev = dev; - netif_carrier_off(netdev); - spin_lock_init(&np->tx_lock); spin_lock_init(&np->rx_lock); @@ -1991,6 +1989,9 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev) SET_NETDEV_DEV(netdev, &dev->dev); np->netdev = netdev; + + netif_carrier_off(netdev); + return netdev; exit_free_tx: -- 2.30.2